<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="contextPath" value="${pageContext.servletContext.contextPath}"></c:set>
<script type="text/javascript">
	function deleteaccount() {
		test.submit();
	}
	function selectAll() {
		var checklist = document.getElementsByName("bookid");
		if (document.getElementById("bookidAll").checked) {
			for (var i = 0; i < checklist.length; i++) {
				checklist[i].checked = true;
			}
		} else {
			for (var j = 0; j < checklist.length; j++) {
				checklist[j].checked = false;
			}
		}
	}
</script>


<div class="table-responsive" style="width: 500px;">
	<form id="test" action="${contextPath}/deluser.htm" method="post">
		<table id="mytable" class="table table-hover"
			style="text-align: center">
			<tr>
				<td style="width: 60px;">用户编号</td>
				<td style="width: 60px;">用户名称</td>
				<td style="width: 60px;">用户email</td>
				<td style="width: 60px;">用户年龄</td>
				<td style="width: 60px;">用户性别</td>
				<td style="width: 80px;">操作</td>
			</tr>
			<c:forEach var="item" varStatus="status" items="${userlist}">
				<tr>
					<td><input type="checkbox" name="bookid"
						value="${item.userId}" />${item.userId}</td>
			
					<td>${item.loginname}</td>
					<td>${item.email}</td>
					<td>${item.age}</td>
					<td>${item.sex}</td>
					<td><a href="${contextPath}/deluser.htm?id=${item.userId}">修改</a> <a
						href="${contextPath}/deluser.htm?id=${item.userId}">删除</a></td>
				</tr>
			</c:forEach>

			<tr>
				<td><input type="checkbox" onclick="selectAll()" id="bookidAll" />全选</td>
				<td><a href="#" style="float: left" onclick="deleteaccount()">删除选中项</a>
				</td>
			</tr>
		</table>
	</form>
</div>
